from typing import Generic
from base_db.session import session_local


global dbm


async def get_db() -> Generic:
    global db

    try:
        db = session_local()
        yield db
    finally:
        db.close()
